package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.BuyOrderBean;
import com.project.service.IBuyOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * 采购订单明细controller
 */
@RequestMapping("buyOrderInfo")
@RestController
public class BuyOrderInfoController {

    @Autowired
    private IBuyOrderInfoService buyOrderInfoService;

    //动态条件分页查询采购订单
    @RequestMapping("findByItem")
    public IPage<BuyOrderBean> findByItem(Integer pageNO, String vendorName,
                                          LocalDate startDate, LocalDate endDate){
        return buyOrderInfoService.findByItem(pageNO, vendorName, startDate, endDate);
    }

    //根据采购id，查询采购基本信息，
    @RequestMapping("findByOrderId")
    public BuyOrderBean findByOrderId(Integer buyOrderId){
        return buyOrderInfoService.findByOrderId(buyOrderId);
    }
}
